<!--header-->
<include file="Common:header"/>

<!--sidebar-->
<include file="Common:left"/>

<!--main-->
<div class="templatemo-content-wrapper">
    <div class="templatemo-content">
        <ol class="breadcrumb">
            <li><a href="{:U('Admin/Index/index')}">Home</a></li>
            <li class="active">Cate info</li>
        </ol>
        <h1>Manage Category</h1>

        <div class="row margin-bottom-30">
            <div class="col-md-12">
                <ul class="nav nav-pills">
                    <li class="active"><a href="#">分类总数 <span class="badge">{$count}</span></a></li>
                </ul>
            </div>
        </div>
        <div class="row">
            <form action="{:U('Admin/Category/sortCate')}" method="post">
            <div class="col-md-12">
                <div class="btn-group pull-right" id="templatemo_sort_btn">
                    <button type="submit" class="btn btn-default btn-success">Sort</button>
                </div>

                <div class="table-responsive">
                    <h4 class="margin-bottom-15">Category List</h4>
                    <table class="table table-striped table-hover table-bordered">
                        <thead>
                        <tr>
                            <th>#</th>
                            <th>分类名称</th>
                            <th>等级</th>
                            <th>排序</th>
                            <th>Edit</th>
                            <th>Delete</th>
                        </tr>
                        </thead>
                        <tbody>
                        <foreach name="cate" item="v">
                            <tr>
                                <td>{$v.id}</td>
                                <td>{$v.html}{$v.name}</td>
                                <td>{$v.level}</td>
                                <td>
                                    <input type="text" name="{$v.id}" value="{$v.sort}"/>
                                </td>
                                <td>
                                    <!-- Split button -->
                                    <div class="btn-group">
                                        <button type="button" class="btn btn-info">Edit</button>
                                        <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown">
                                            <span class="caret"></span>
                                            <span class="sr-only">Toggle Dropdown</span>
                                        </button>
                                        <ul class="dropdown-menu" role="menu">
                                            <li><a href="{:U('Admin/Category/editCate', array('id' => $v['id']))}">修改</a></li>
                                            <if condition="$v.level eq 3">
                                                 &nbsp&nbsp&nbsp达到上限分级
                                                <else/>
                                                <li><a href="{:U('Admin/Category/addCate', array('pid' => $v['id']))}">添加子分类</a></li>

                                            </if>
                                        </ul>
                                    </div>
                                </td>
                                <td><a href="{:U('Admin/Category/delete', array('id' => $v['id']))}" class="btn btn-danger">Delete</a></td>
                            </tr>
                        </foreach>
                        </tbody>
                    </table>
                </div>
                {$page}
            </div>
            </form>
        </div>
    </div>
</div>

<include file="Common:footer"/>